home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 2 / Mac Magazin and MacEasy Magazine CD - Issue 02.iso / Sharewarebibliothek / Applikationen / Alpha.5.81 folder / Tcl / UserCode / smart.tcl < prev    next >
Text File  |  1994-06-08  |  609b  |  39 lines

  1.  
  2.  
  3. proc smartDQuote {} {
  4.     global smartQuotes
  5.     if {!$smartQuotes} { insertText {"}; return }
  6.     if {[leftQ]} {
  7.         insertText {``}
  8.     } else {
  9.         insertText {''}
  10.     }
  11. }
  12. ascii 0x22 <s> smartDQuote TeX
  13.  
  14. proc smartQuote {} {
  15.     global smartQuotes
  16.     if {!$smartQuotes} { insertText {'}; return }
  17.     if {[leftQ]} {
  18.         insertText {`}
  19.     } else {
  20.         insertText {'}
  21.     }
  22. }
  23. ascii 0x27 smartQuote TeX
  24.  
  25. proc leftQ {} {
  26.     if {[getPos] == 0} {return 1};
  27.     set q [lookAt [expr [getPos]-1]]
  28.     case $q in {
  29.         {\t}  {return 1}
  30.         {(}  {return 1}
  31.         {\{}  {return 1}
  32.         {[}  {return 1}
  33.         {<}  {return 1}
  34.         {\ } {return 1}
  35.         {\r} {return 1}
  36.     }
  37.     return 0
  38. }
  39.